package xiangmu.schoolpaper.controller.system;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xiangmu.schoolpaper.pojo.VO.GetTeacherVO;
import xiangmu.schoolpaper.pojo.VO.TemplateOneVO;
import xiangmu.schoolpaper.result.Result;
import xiangmu.schoolpaper.service.impl.system.GetTeacherServiceImpl;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/system")
@Tag(name="管理员端获取专业，老师，毕业年份")
public class GetTeacherController {
    @Autowired
        private GetTeacherServiceImpl getTeacherServiceImpl;

//    @GetMapping("/get/yearbymajor")
//    @Operation(summary = "获取某一专业所在的所有年份")
//    public Result getyearBymajor(String major) {
//        log.info("查询id为{}的模板信息", major);
//        List<String> getteacher = getTeacherServiceImpl.getyearBymajor(major);
//        if(getteacher==null){
//            return Result.error("没有此专业所毕业学生的年份");
//        }
//        return Result.success(getteacher);
//    }

    @GetMapping("/get/yearbyteacher")
    @Operation(summary = "获取某一指导老师所在的所有年份")
    public Result getyearByteacher(String teacher) {
        log.info("查询id为{}的模板信息", teacher);
        List<String > getteacher = getTeacherServiceImpl.getyearByteacher(teacher);
        if(getteacher==null){
            return Result.error("没有此指导老师所指导学生的年份");
        }
        return Result.success(getteacher);
    }

    @GetMapping("/get/teacherbyyear")
    @Operation(summary = "获取某一毕业年份下所有老师")
    public Result getteacherByyear(Integer year) {
        log.info("查询id为{}的模板信息", year);
        List<String> getteacher = getTeacherServiceImpl.getteacherByyear(year);
        return Result.success(getteacher);
    }
}
